package com.bestcem.xm.ticket.dao;

import com.bestcem.xm.ticket.entity.mongo.TicketNotifyConfig;

import java.util.List;

/**
 * 工单通知配置
 *
 * @author jy.zhao
 * @version 1.0
 * @date 2021/8/16 16:13
 **/
public interface TicketNotifyConfigDao {

    /**
     * 根据id查询工单通知配置
     *
     * @param id 工单通知配置id
     * @return TicketNotifyConfig
     * @author jy.zhao
     * @date 2021/8/16 16:13
     **/
    TicketNotifyConfig findById(String id);

    /**
     * 查找 ticketConfigId 对应的所有 TicketNotifyConfig
     *
     * @param ticketConfigId ticketConfigId
     * @return ticketConfigId 对应的所有 TicketNotifyConfig
     * @author XiaoYunSong <ys.xiao@idiaoyan.com>
     * @date 2021/8/16 16:33
     */
    List<TicketNotifyConfig> findAllByTicketConfigId(String ticketConfigId);

    /**
     * 根据邮箱id查询工单通知配置
     *
     * @param smtpIds
     * @return TicketNotifyConfig
     * @author jy.zhao
     * @date 2021/8/16 16:29
     **/
    List<TicketNotifyConfig> findBySmtpIds(List<String> smtpIds);

    /**
     * 清除通知配置中的邮箱id
     *
     * @param smtpIds 邮箱id列表
     * @author jy.zhao
     * @date 2021/8/16 16:39
     **/
    void clearSmtpId(List<String> smtpIds);


    /**
     * 根据id列表查询通知配置
     *
     * @param ids
     * @return List<TicketNotifyConfig>
     * @version v1.0
     * @author gy.liu
     * @date 2021/8/17
     */
    List<TicketNotifyConfig> findAllByIds(List<String> ids);

    /**
     * 保存通知配置
     *
     * @param ticketNotifyConfig
     * @return TicketNotifyConfig
     * @version v1.0
     * @author gy.liu
     * @date 2021/8/18
     */
    TicketNotifyConfig saveTicketNotifyConfig(TicketNotifyConfig ticketNotifyConfig);


    /**
     * 批量新增实体
     *
     * @param ticketNotifyConfigs 创建实体list
     * @return 新增的实体id list
     */
    List<String> batchInsert(List<TicketNotifyConfig> ticketNotifyConfigs);

    /**
     * 根据id和事件获取单条工单通知配置
     *
     * @param ticketConfigId
     * @param event
     * @return TicketNotifyConfig
     * @version v1.0
     * @author gy.liu
     * @date 2021/8/23
     */
    TicketNotifyConfig findNotifyConfigByIdEvent(String ticketConfigId, Integer event);

    /**
     * 使用实体类覆盖修改
     *
     * @param id
     * @param entity
     * @return
     * @author liheng
     * @date 2021/8/26 11:24
     */
    TicketNotifyConfig updateNotifyConfig(String id, TicketNotifyConfig entity);
}
